import { createRouter,createWebHashHistory } from "vue-router";

import LoginCom from "@/components/LoginCom.vue";
import HomeCom from "@/components/HomeCom.vue";
import AddPerson from "@/components/AddPerson.vue";
import ListPerson from "@/components/ListPerson.vue";
import SchoolList from "@/components/SchoolList.vue";
import ZhuCe from "@/components/ZhuCe.vue";
import EditPerson from "@/components/EditPerson.vue";
import ProductList from "@/components/ProductList.vue";
import EditProd from "@/components/EditProd.vue"

const routes=[
    {
        path:'/',
        redirect:'/login'
    },
    {
        path:'/login',
        name:"LoginCom",
        component:LoginCom,
    },
            {
                path:'/zhuce',
                name:'ZhuCe',
                component:ZhuCe
            },
    {
        path:'/home',
        name:"HomeCom",
        component:HomeCom,
        //children属性：设置首页的子路由
        children:[
            {
                path:'add',
                name:'AddPerson',
                component:AddPerson
            },
            {
                path:'list',
                name:'ListPerson',
                component:ListPerson
            },
            {
                path:'school',
                name:'SchoolList',
                component:SchoolList
            },
            {
                path:'edit',
                name:'EditPerson',
                component:EditPerson                
            },
            {
                path:'product',
                name:'ProductList',
                component:ProductList                 
            },
            {
                path:'editprod',
                name:'EditProd',
                component:EditProd                 
            }
        ]
    },
];

const router=createRouter({
    routes,
    history:createWebHashHistory(),
});

export default router;